<%@ page import="com.dailyblue.java.servlet.jsp.dao.EmpDAO" %>
<%@ page import="java.util.List" %>
<%@ page import="com.dailyblue.java.servlet.jsp.bean.Emp" %>
<%@ page import="com.dailyblue.java.servlet.jsp.dao.DeptDAO" %>
<%@ page import="com.dailyblue.java.servlet.jsp.bean.Dept" %><%--
  Created by IntelliJ IDEA.
  User: dailyblue
  Date: 2023/4/1
  Time: 17:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    EmpDAO edao = new EmpDAO();
    DeptDAO ddao = new DeptDAO();
    List<String> jobs = edao.findAllJob();
    List<Emp> mgrs = edao.findAllEmp();
    List<Dept> depts = ddao.findAllDept();
%>
<form action="9-2.jsp" method="post">
    姓名：<input type="text" name="ename"/><br/>
    职位：
    <select name="job">
        <%
            for (String s : jobs) {
                out.print("<option>" + s + "</option>");
            }
        %>
    </select>
    <br/>
    上司ID：
    <select name="mgr">
        <%
            for (Emp s : mgrs) {
                out.print("<option value='" + s.getEmpNo() + "'>" + s.getEname() + "</option>");
            }
        %>
    </select>
    <br/>
    工资：<input type="text" name="sal"/><br/>
    奖金：<input type="text" name="comm"/><br/>
    部门ID：
    <select name="deptNo">
        <%
            for (Dept d : depts) {
                out.print("<option value='" + d.getDeptNo() + "'>" + d.getDname() + "</option>");
            }
        %>
    </select>
    <br/>
    <button>录入新员工</button>
</form>
</body>
</html>
